const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const Time = require('../public/javascripts/time')

const AdminSchema = new Schema({
    zhanghao: {
        type: String,
        required: true
    },
    username: {
        type: String,
        required: true
    },
    password: {
        type: String,
        required: true
    },
    state: {
        type: Number,
        default: 0
    },
    avatar: {       //头像
        type: String,
        default: 'http://127.0.0.1:3000/uploads/writers/moren.jpg'
    },
    date: {
        type: Date,
        default: new Time().getTime()
    },
})

module.exports = Admin = mongoose.model("admins", AdminSchema);